package conf2.ui;

import conf2.model.ETerritory;
import java.awt.Color;

public class ColorSet {

    public static final Color BOARD_BG = new Color(152, 130, 87);
    public static final Color SHIRE_BG = new Color(255, 255, 200);
    public static final Color LIGHTREGION_BG = new Color(255, 255, 127);
    public static final Color MOUNTAIN_BG = new Color(127, 127, 127);
    public static final Color DARKREGION_BG = new Color(64, 32, 64);
    public static final Color MORDOR_BG = new Color(32, 32, 32);
    public static final Color LIGHTACTOR_FRAME = Color.BLACK;
    public static final Color LIGHTACTOR_TEXT = Color.BLACK;
    public static final Color LIGHTACTOR_BG = Color.WHITE;
    public static final Color LIGHTACTOR_FRAME_CLICK = Color.WHITE;
    public static final Color LIGHTACTOR_TEXT_CLICK = Color.WHITE;
    public static final Color LIGHTACTOR_BG_CLICK = Color.BLUE;
    public static final Color LIGHTACTOR_BG_HOVER = new Color(220, 220, 255);
    public static final Color DARKACTOR_FRAME = Color.WHITE;
    public static final Color DARKACTOR_TEXT = Color.WHITE;
    public static final Color DARKACTOR_BG = Color.BLACK;
    public static final Color DARKACTOR_FRAME_CLICK = Color.BLACK;
    public static final Color DARKACTOR_TEXT_CLICK = Color.BLACK;
    public static final Color DARKACTOR_BG_CLICK = Color.RED;
    public static final Color DARKACTOR_BG_HOVER = new Color(127, 0, 0);
    public static final Color LIGHTCARD_BG = LIGHTREGION_BG;
    public static final Color LIGHTCARD_TEXT = Color.BLACK;
    public static final Color DARKCARD_BG = DARKREGION_BG;
    public static final Color DARKCARD_TEXT = Color.WHITE;
    public static final Color BATTLE_DIALOG_MESSAGE_BG = new Color(64, 64, 64);
    public static final Color BUSYBOX_BG = new Color(224, 224, 224);
    public static final Color BUSYBOX_TEXT = Color.BLACK;
    public static final Color PLACEMENT_INFO_TEXT = Color.WHITE;
    public static final Color PLACEMENT_INFO_BG = new Color(127, 0, 0);

    public static Color contrastingColor(Color bg) {
        int luminance = 77 * bg.getRed() +
                150 * bg.getGreen() +
                29 * bg.getBlue();
        luminance = luminance >> 8;
        if (luminance < 127) {
            return Color.WHITE;
        } else {
            return Color.BLACK;
        }
    }

    static Color getRegionBg(ETerritory et) {
        switch (et) {
            case SHIRE:
                return SHIRE_BG;
            case ARTHEDAIN:
            case RHUDAUR:
            case CARDOLAN:
            case EREGION:
            case ENEDWAITH:
                return LIGHTREGION_BG;
            case HIGHPASS:
            case MISTYMTS:
            case MORIA:
            case GAPOFROHAN:
                return MOUNTAIN_BG;
            case ROHAN:
            case MIRKWOOD:
            case FANGORN:
            case DAGORLAD:
            case GONDOR:
                return DARKREGION_BG;
            case MORDOR:
                return MORDOR_BG;
            default:
                return null;


        }
    }
}
